package com.kahriboo.log4mon.client;

import java.util.Date;

import com.kahriboo.log4mon.shared.LogEventShared;
import com.smartgwt.client.widgets.grid.ListGridRecord;

public class LogEventRecord extends ListGridRecord {

	public LogEventRecord() {
	}

	public LogEventRecord(final LogEventShared source) {
		setAttribute("timeStamp", new Date(source.getTimeStamp()));
		setAttribute("level", source.getLevel());
		setAttribute("threadName", source.getThreadName());
		setAttribute("className", source.getClassName());
		setAttribute("methodName", source.getMethodName());
		setAttribute("fileName", source.getFileName());
		setAttribute("lineNumber", Integer.valueOf(source.getLineNumber()));
		setAttribute("loggerName", source.getLoggerName());
		setAttribute("message", source.getMessage());
		setAttribute("throwableClass", source.getThrowableClass());
		setAttribute("throwable", "source.getThrowable()");

	}

	public Date getTimeStamp() {
		return getAttributeAsDate("timeStamp");
	}

	public void setTimeStamp(final Date timeStamp) {
		setAttribute("timeStamp", timeStamp);
	}

	public String getLevel() {
		return getAttributeAsString("level");
	}

	public void setLevel(final String level) {
		setAttribute("level", level);
	}

	public String getThreadName() {
		return getAttributeAsString("threadName");
	}

	public void setThreadName(final String threadName) {
		setAttribute("threadName", threadName);
	}

	public String getClassName() {
		return getAttributeAsString("className");
	}

	public void setClassName(final String className) {
		setAttribute("className", className);
	}

	public String getMethodName() {
		return getAttributeAsString("methodName");
	}

	public void setMethodName(final String methodName) {
		setAttribute("methodName", methodName);
	}

	public String getFileName() {
		return getAttributeAsString("fileName");
	}

	public void setFileName(final String fileName) {
		setAttribute("fileName", fileName);
	}

	public Integer getLineNumber() {
		return getAttributeAsInt("lineNumber");
	}

	public void setLineNumber(final Integer lineNumber) {
		setAttribute("lineNumber", lineNumber);
	}

	public String getLoggerName() {
		return getAttributeAsString("loggerName");
	}

	public void setLoggerName(final String loggerName) {
		setAttribute("loggerName", loggerName);
	}

	public String getMessage() {
		return getAttributeAsString("message");
	}

	public void setMessage(final String message) {
		setAttribute("message", message);
	}

	public String getThrowableClass() {
		return getAttributeAsString("throwableClass");
	}

	public void setThrowableClass(final String throwableClass) {
		setAttribute("throwableClass", throwableClass);
	}

	public String getThrowable() {
		return getAttributeAsString("throwable");
	}

	public void setThrowable(final String throwable) {
		setAttribute("throwable", throwable);
	}
}
